#pragma once
#include"List.h"
namespace qlh
{
	template<typename Iterator,class Ref,class Ptr>
	struct reverse_iterator
	{
		typedef reverse_iterator<Iterator, Ref, Ptr> Self;
		reverse_iterator(Iterator it)
			:_it(it)
		{}
		Ref operator*()
		{
			Iterator tmp = _it;
			return *(--tmp);
		}
		Ptr operator->()
		{
			return &(operator*());
		}
		Self& operator++()
		{
			--_it;
			return *this;
		}
		Self operator++(int)
		{
			Self tmp(*this);
			--_it;
			return *tmp;
		}
		Self& operator--()
		{
			++_it;
			return *this;
		}
		Self operator--(int)
		{
			Self tmp(*this);
			++_it;
			return *tmp;
		}
		bool operator!=(const Self& it)const
		{
			return _it != it._it;
		}
		bool operator==(const Self& it)const
		{
			return _it == it._it;
		}
		Iterator _it;
	};
}